<!DOCTYPE html>
<html>
<body>
<input type="file" name="file" id="file" onchange="onInputFileChange()">
<pre id='console'></pre>

<script>
function log(message)
{
    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}

function onInputFileChange()
{
    var file = document.getElementById("file").files[0];
    var worker = new Worker("../resources/apply-blob-url-to-xhr.js");
    worker.onmessage = function(event)
    {
        log(event.data);
        if (event.data == "DONE") {
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }
    worker.onerror = function(event)
    {
        log("Received error from worker: " + event.message);
        if (window.testRunner)
            testRunner.notifyDone();
    }
    worker.postMessage(file);
}

function runTests()
{
    eventSender.beginDragWithFiles(['../resources/UTF8.txt']);
    eventSender.mouseMoveTo(10, 10);
    eventSender.mouseUp();
}

if (window.eventSender) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    window.onload = runTests;
}
</script>
</body>
</html>
